package com.jyu.reggie.config;

import org.springframework.cache.annotation.CachingConfigurationSelector;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
 * redis 值 之定义序列化
 */
@Configuration
public class RedisConfig extends CachingConfigurerSupport {

    @Bean
    public RedisTemplate<Object,Object> redisTemplate(RedisConnectionFactory ConnectionFactory){
        RedisTemplate<Object, Object> template = new RedisTemplate<>();

        template .setKeySerializer(new StringRedisSerializer());


        template.setConnectionFactory(ConnectionFactory);

        return template;
    }

}
